<template>
<h1>EL-开关组件</h1>
  <el-switch v-model="value1" />
  <el-switch
      v-model="value2"
      class="ml-2"
      style="--el-switch-on-color: #13ce66; --el-switch-off-color: #49ceff"
  />
  <br>
  <hr>
  <el-switch v-model="isShow"></el-switch>
  <hr>
  <img src="../../public/fcq.jpg" width="200" v-if="isShow">
  <hr>
  <el-switch v-model="numStr" active-value="0" inactive-value="1"></el-switch>
  <hr>
<!--  如果进行了属性绑定，'1'才可以被看作是字符串类型的1-->
  <el-switch v-model="numStr" :active-value="'1'" :inactive-value="'0'"></el-switch>
  <hr>
<!-- 当 num是数字类型时，就需要属性绑定，否则1会被看作是字符串，无法生效 -->
  <el-switch v-model="num" :active-value="1" :inactive-value="0"></el-switch>
</template>

<script setup>
import { ref } from 'vue'

const value1 = ref(false)
const value2 = ref(false)
const isShow = ref(true)
const numStr =ref('1')
const num =ref(1)
</script>


<style scoped>

</style>